package main

import (
	"encoding/json"
	"fmt"
)

type Person struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

func main() {
	var data = []interface{}{
		"hello",
		"world",
		1314,
		map[string]interface{}{"name": "eissa", "age": "18"},
		Person{"ttao", 18},
	}

	marshal, _ := json.Marshal(data)
	fmt.Println(string(marshal))

	jsonstr := `["hello","world",1314,{"age":"18","name":"eissa"},{"name":"ttao","age":18}]`

	var value []interface{}
	err := json.Unmarshal([]byte(jsonstr), &value)
	if err != nil {
		return
	}
	fmt.Println(value)
}
